#ifndef __C_STD_DEBUG_H__
#define __C_STD_DEBUG_H__

#include "./../std/std.h"

#ifdef __cplusplus
extern "C" {
#endif

// debug output
void krnl_dbg_output1(const char *fmt, ...);
void krnl_dbg_output2(const char *fmt, ...);
void krnl_dbg_output3(const char *fmt, ...);

// die
void go32_die_endless(void);

// assert
#ifndef VISKRNL_DBG

// non-debug version
#define kassert(expr)		((void)0)

#ifdef TEST_DBG_WIN32
#define dbg_output1		krnl_dbg_output1
#define dbg_output2		krnl_dbg_output1
#define dbg_output3		krnl_dbg_output1
#else
#define dbg_output1
#define dbg_output2
#define dbg_output3
#endif

#else

#ifdef TEST_DBG_WIN32
#include <assert.h>
#define kassert	assert
#define dbg_output1		krnl_dbg_output1
#define dbg_output2		krnl_dbg_output2
#define dbg_output3		krnl_dbg_output3
#else

void _kassert(const char *str, const char *fn, uint ln);

// debug version
#define kassert(e)		((e) ? (void)0 : _kassert(#e, __FILE__, __LINE__))
#if (DBG_LEVEL == DBG_LEVEL1)
#define dbg_output1		krnl_dbg_output1
#define dbg_output2		(void)
#define dbg_output3		(void)
#elif (DBG_LEVEL == DBG_LEVEL2)
#define dbg_output1		krnl_dbg_output1
#define dbg_output2		krnl_dbg_output2
#define dbg_output3		(void)
#elif (DBG_LEVEL == DBG_LEVEL3)
#define dbg_output1		krnl_dbg_output1
#define dbg_output2		krnl_dbg_output2
#define dbg_output3		krnl_dbg_output3
#endif
#endif
#endif

void bug(const char *fmt, ...);

#ifdef __cplusplus
}
#endif
#endif
/* EOF */
